home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / plaf / basic / BasicPopupMenuUI.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.7 KB  |  92 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Dimension;
  5. import java.awt.Frame;
  6. import java.awt.Window;
  7. import javax.swing.JComponent;
  8. import javax.swing.JPopupMenu;
  9. import javax.swing.LookAndFeel;
  10. import javax.swing.plaf.ComponentUI;
  11. import javax.swing.plaf.PopupMenuUI;
  12. import javax.swing.plaf.UIResource;
  13.  
  14. public class BasicPopupMenuUI extends PopupMenuUI {
  15.    protected JPopupMenu popupMenu = null;
  16.    private Frame frame;
  17.    private static transient MouseGrabber mouseGrabber = null;
  18.  
  19.    // $FF: synthetic method
  20.    static Window access$0(Component var0) {
  21.       return getWindow(var0);
  22.    }
  23.  
  24.    public static ComponentUI createUI(JComponent var0) {
  25.       return new BasicPopupMenuUI();
  26.    }
  27.  
  28.    public Dimension getMaximumSize(JComponent var1) {
  29.       return this.getPreferredSize(var1);
  30.    }
  31.  
  32.    public Dimension getMinimumSize(JComponent var1) {
  33.       return this.getPreferredSize(var1);
  34.    }
  35.  
  36.    public Dimension getPreferredSize(JComponent var1) {
  37.       return null;
  38.    }
  39.  
  40.    private static Window getWindow(Component var0) {
  41.       Object var1;
  42.       for(var1 = var0; !(var1 instanceof Window) && var1 != null; var1 = ((Component)var1).getParent()) {
  43.       }
  44.  
  45.       return (Window)var1;
  46.    }
  47.  
  48.    public void installDefaults() {
  49.       if (this.popupMenu.getLayout() == null || this.popupMenu.getLayout() instanceof UIResource) {
  50.          this.popupMenu.setLayout(new DefaultMenuLayout(this.popupMenu, 1));
  51.       }
  52.  
  53.       this.popupMenu.setOpaque(true);
  54.       LookAndFeel.installBorder(this.popupMenu, "PopupMenu.border");
  55.       LookAndFeel.installColorsAndFont(this.popupMenu, "PopupMenu.background", "PopupMenu.foreground", "PopupMenu.font");
  56.    }
  57.  
  58.    protected void installKeyboardActions() {
  59.    }
  60.  
  61.    protected void installListeners() {
  62.       if (mouseGrabber == null) {
  63.          mouseGrabber = new MouseGrabber();
  64.       }
  65.  
  66.    }
  67.  
  68.    public void installUI(JComponent var1) {
  69.       this.popupMenu = (JPopupMenu)var1;
  70.       this.installDefaults();
  71.       this.installListeners();
  72.       this.installKeyboardActions();
  73.    }
  74.  
  75.    protected void uninstallDefaults() {
  76.       LookAndFeel.uninstallBorder(this.popupMenu);
  77.    }
  78.  
  79.    protected void uninstallKeyboardActions() {
  80.    }
  81.  
  82.    protected void uninstallListeners() {
  83.    }
  84.  
  85.    public void uninstallUI(JComponent var1) {
  86.       this.uninstallDefaults();
  87.       this.uninstallListeners();
  88.       this.uninstallKeyboardActions();
  89.       this.popupMenu = null;
  90.    }
  91. }
  92.